{% extends "base.html" %}

{% block breadcrumb_current %}
    公共参数  > 用户列表 > 重置密码
{% endblock %}
{% block content %}

    {% if messages %}
        {% for message in messages %}
            <div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
                {{ message }}
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </div>
        {% endfor %}
    {% endif %}
    
    <div class="bg-light p-3 shadow-sm">
        <h5 style="color: #417690;">
            重置{{ user.username }}的密码
            <a href="{% url 'user_list' %}" class="btn btn-secondary btn-sm float-end" style="margin-left: 15px;">返回用户列表</a></h5>
    </div>


<div class="container" style="margin-top: 50px;">
    <div class="card">
        <div class="card-body">
            <form method="post">
                {% csrf_token %}
                <div class="row" style="margin-top: 40px;">
                    <div class="col-md-6 mb-3">
                        <label for="{{ form.new_password1.id_for_label }}" class="form-label">新密码</label>
                        <input type="password" name="{{ form.new_password1.name }}" id="{{ form.new_password1.id_for_label }}"
                            class="form-control {% if form.new_password1.errors %}is-invalid{% endif %}">
                        {% if form.new_password1.errors %}
                            <div class="invalid-feedback">{{ form.new_password1.errors|join:", " }}</div>
                        {% endif %}
                    </div>
                    <div class="col-md-6 mb-3">
                        <label for="{{ form.new_password2.id_for_label }}" class="form-label">确认新密码</label>
                        <input type="password" name="{{ form.new_password2.name }}" id="{{ form.new_password2.id_for_label }}"
                            class="form-control {% if form.new_password2.errors %}is-invalid{% endif %}">
                        {% if form.new_password2.errors %}
                            <div class="invalid-feedback">{{ form.new_password2.errors|join:", " }}</div>
                        {% endif %}
                    </div>
                </div>
            <!-- 操作按钮 -->
                <div class="row" style="margin-top: 40px;">
                    <div class="col-md-12 text-center">
                        <!-- <a href="{% url 'user_list' %}" class="btn btn-secondary">取 消</a> -->
                        <button type="submit" class="btn ms-2" style="background-color: #417690; color: white;">保 存</button>            </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
{% endblock %}